package com.chankudo.demo2;

public class Demo2NonStaticFactory {
    public Demo2Product product = new Demo2Product();
    //java代码块，在构造函数之前执行。
    {
        product.setProductId("001");
    }

    public Demo2Product getProductInstance(){
        return new Demo2Product();
    }

    public Demo2Product getProductInstanceById(String id){
        Demo2Product  product = new Demo2Product();
        product.setProductId(id);
        return product;
    }

    public Demo2Product getStaticProductInstance(){
        return product;
    }

}
